Name-Index Numbers

When a simulation begins, locations, resources, and entities are all assigned numbers according to their position in their respective edit tables. The number assigned to the element is called its name-index number. For example, the third entity in the Entity edit table will have the number three for its name index number. The name of an element may be used in an expression to reference its name-index number.

For example, if EntityA were the third entity in the Entity edit table, the statement, "Attr1 = EntityA," would assign the number three to Attr1, because attributes take numbers. Additionally, you may also test for an index number by referencing the element name with a statement like, "IF Var5 = Location3 THEN." In fact, when using a name-index number to identify a location, resource, or entity (as in the previous examples), it is usually best to use the name of the element, because inserting or deleting an element from the edit table, may change the name-index number assigned to other elements.

If you need to refer to a location, resource, or entity by name but only know its name-index number, use the name functions: LOC(), RES(), and ENT(). These functions allow name-index numbers and variables or attributes containing name-index numbers to be converted back to their actual names for use in statements or expressions requiring the element name.

Consider the statement, "Attr1 = PASSENGER." Although this statement only stores the name index number of the element in the attribute, the name-index number can then be used in conjunction with LOC(), ENT(), and RES() to get the actual name of the location. For example, if PASSENGER is the fifth entity in the Entity edit table, the statement JOIN 1 ENT(Attr1) works the same as JOIN 1 PASSENGER. Additionally, a name-index number can be used with the name functions to output a name to the screen or a file.